package ntd.util.modular.common.controller;

import cn.hutool.log.StaticLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.c.Constant;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = {"公共服务中心-通用功能"})
public class CommonController {

    /**
     * 状态控制 - springActuator
     * 在线状态：localhost:8080/actuator/health - {"status":"UP"}
     * 停止服务：curl -X POST localhost:8080/actuator/shutdown
     * @return
     */
    @GetMapping("server-state")
    @ApiOperation("服务状态检测")
    public String serverStatus(@RequestParam(value = "timestamp", defaultValue = "World") String timestamp) {
        StaticLog.info(timestamp);
        return Constant.OK;
    }

    @GetMapping
    @ApiOperation("空连接访问返回")
    public String index() {
        return "欢迎访问 公共能力中心，祝您使用愉快！";
    }

}
